package com.dobbinsoft.iotechn.data.config.notify;

import com.dobbinsoft.iotechn.data.client.AdminNotifyClient;
import com.dobbinsoft.iotechn.data.client.MockAdminNotifyClient;
import com.dobbinsoft.iotechn.data.client.UninotifyAdminNotifyClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: rize
 * Date: 2020/4/29
 * Time: 10:20
 */
@Configuration
public class AdminNotifyConfig {

    @Value("${com.dobbinsoft.framework.notify.enable}")
    private String enable;

    @Bean
    public AdminNotifyClient adminNotifyClient() {
        if ("mock".equals(enable)) {
            return new MockAdminNotifyClient();
        } else if ("uninotify".equals(enable)) {
            return new UninotifyAdminNotifyClient();
        } else {
            return null;
        }

    }

}
